\(\int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx\) [673]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 39, antiderivative size = 55 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=-\frac {a (A-i B)}{3 c^3 f (i+\tan (e+f x))^3}-\frac {a B}{2 c^3 f (i+\tan (e+f x))^2} \]

[Out]

-1/3*a*(A-I*B)/c^3/f/(I+tan(f*x+e))^3-1/2*a*B/c^3/f/(I+tan(f*x+e))^2

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 45} \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=-\frac {a (A-i B)}{3 c^3 f (\tan (e+f x)+i)^3}-\frac {a B}{2 c^3 f (\tan (e+f x)+i)^2} \]

[In]

Int[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^3,x]

[Out]

-1/3*(a*(A - I*B))/(c^3*f*(I + Tan[e + f*x])^3) - (a*B)/(2*c^3*f*(I + Tan[e + f*x])^2)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int \frac {A+B x}{(c-i c x)^4} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a c) \text {Subst}\left (\int \left (\frac {A-i B}{c^4 (i+x)^4}+\frac {B}{c^4 (i+x)^3}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = -\frac {a (A-i B)}{3 c^3 f (i+\tan (e+f x))^3}-\frac {a B}{2 c^3 f (i+\tan (e+f x))^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.49 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.75 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=-\frac {a (2 A+i B+3 B \tan (e+f x))}{6 c^3 f (i+\tan (e+f x))^3} \]

[In]

Integrate[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^3,x]

[Out]

-1/6*(a*(2*A + I*B + 3*B*Tan[e + f*x]))/(c^3*f*(I + Tan[e + f*x])^3)

Maple [A] (verified)

Time = 0.15 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.78

method result size
derivativedivides \(\frac {a \left (-\frac {B}{2 \left (i+\tan \left (f x +e \right )\right )^{2}}-\frac {-i B +A}{3 \left (i+\tan \left (f x +e \right )\right )^{3}}\right )}{f \,c^{3}}\) \(43\)
default \(\frac {a \left (-\frac {B}{2 \left (i+\tan \left (f x +e \right )\right )^{2}}-\frac {-i B +A}{3 \left (i+\tan \left (f x +e \right )\right )^{3}}\right )}{f \,c^{3}}\) \(43\)
risch \(-\frac {a \,{\mathrm e}^{6 i \left (f x +e \right )} B}{24 c^{3} f}-\frac {i a \,{\mathrm e}^{6 i \left (f x +e \right )} A}{24 c^{3} f}-\frac {i A a \,{\mathrm e}^{4 i \left (f x +e \right )}}{8 c^{3} f}+\frac {a \,{\mathrm e}^{2 i \left (f x +e \right )} B}{8 c^{3} f}-\frac {i a \,{\mathrm e}^{2 i \left (f x +e \right )} A}{8 c^{3} f}\) \(100\)

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x,method=_RETURNVERBOSE)

[Out]

1/f*a/c^3*(-1/2*B/(I+tan(f*x+e))^2-1/3*(A-I*B)/(I+tan(f*x+e))^3)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.07 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=\frac {{\left (-i \, A - B\right )} a e^{\left (6 i \, f x + 6 i \, e\right )} - 3 i \, A a e^{\left (4 i \, f x + 4 i \, e\right )} - 3 \, {\left (i \, A - B\right )} a e^{\left (2 i \, f x + 2 i \, e\right )}}{24 \, c^{3} f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

1/24*((-I*A - B)*a*e^(6*I*f*x + 6*I*e) - 3*I*A*a*e^(4*I*f*x + 4*I*e) - 3*(I*A - B)*a*e^(2*I*f*x + 2*I*e))/(c^3
*f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 201 vs. \(2 (44) = 88\).

Time = 0.25 (sec) , antiderivative size = 201, normalized size of antiderivative = 3.65 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=\begin {cases} \frac {- 192 i A a c^{6} f^{2} e^{4 i e} e^{4 i f x} + \left (- 192 i A a c^{6} f^{2} e^{2 i e} + 192 B a c^{6} f^{2} e^{2 i e}\right ) e^{2 i f x} + \left (- 64 i A a c^{6} f^{2} e^{6 i e} - 64 B a c^{6} f^{2} e^{6 i e}\right ) e^{6 i f x}}{1536 c^{9} f^{3}} & \text {for}\: c^{9} f^{3} \neq 0 \\\frac {x \left (A a e^{6 i e} + 2 A a e^{4 i e} + A a e^{2 i e} - i B a e^{6 i e} + i B a e^{2 i e}\right )}{4 c^{3}} & \text {otherwise} \end {cases} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**3,x)

[Out]

Piecewise(((-192*I*A*a*c**6*f**2*exp(4*I*e)*exp(4*I*f*x) + (-192*I*A*a*c**6*f**2*exp(2*I*e) + 192*B*a*c**6*f**
2*exp(2*I*e))*exp(2*I*f*x) + (-64*I*A*a*c**6*f**2*exp(6*I*e) - 64*B*a*c**6*f**2*exp(6*I*e))*exp(6*I*f*x))/(153
6*c**9*f**3), Ne(c**9*f**3, 0)), (x*(A*a*exp(6*I*e) + 2*A*a*exp(4*I*e) + A*a*exp(2*I*e) - I*B*a*exp(6*I*e) + I
*B*a*exp(2*I*e))/(4*c**3), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 140 vs. \(2 (45) = 90\).

Time = 0.64 (sec) , antiderivative size = 140, normalized size of antiderivative = 2.55 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=-\frac {2 \, {\left (3 \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 6 i \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 3 \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 10 \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 2 i \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 6 i \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{3 \, c^{3} f {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{6}} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x, algorithm="giac")

[Out]

-2/3*(3*A*a*tan(1/2*f*x + 1/2*e)^5 + 6*I*A*a*tan(1/2*f*x + 1/2*e)^4 - 3*B*a*tan(1/2*f*x + 1/2*e)^4 - 10*A*a*ta
n(1/2*f*x + 1/2*e)^3 - 2*I*B*a*tan(1/2*f*x + 1/2*e)^3 - 6*I*A*a*tan(1/2*f*x + 1/2*e)^2 + 3*B*a*tan(1/2*f*x + 1
/2*e)^2 + 3*A*a*tan(1/2*f*x + 1/2*e))/(c^3*f*(tan(1/2*f*x + 1/2*e) + I)^6)

Mupad [B] (verification not implemented)

Time = 8.92 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.15 \[ \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx=\frac {\frac {a\,\left (2\,A+B\,1{}\mathrm {i}\right )}{6}+\frac {B\,a\,\mathrm {tan}\left (e+f\,x\right )}{2}}{c^3\,f\,\left (-{\mathrm {tan}\left (e+f\,x\right )}^3-{\mathrm {tan}\left (e+f\,x\right )}^2\,3{}\mathrm {i}+3\,\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )} \]

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i))/(c - c*tan(e + f*x)*1i)^3,x)

[Out]

((a*(2*A + B*1i))/6 + (B*a*tan(e + f*x))/2)/(c^3*f*(3*tan(e + f*x) - tan(e + f*x)^2*3i - tan(e + f*x)^3 + 1i))